Spatial Point Patterns Analysis of Airbnb Listing in Singapore.
pre code, pre, code {
white-space: pre !important;
overflow-x: scroll !important;
word-break: keep-all !important;
word-wrap: initial !important;
}MRT_sf <- st_read(dsn = "data/LTA_TrainStation_Aug2021", layer="MRTLRTStnPtt")
Reading layer `MRTLRTStnPtt' from data source
`C:\yiling-yu\IS415_Blog\_posts\2021-09-25-take-home-exercise-2\data\LTA_TrainStation_Aug2021'
using driver `ESRI Shapefile'
Simple feature collection with 171 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 6138.311 ymin: 27555.06 xmax: 45254.86 ymax: 47854.2
Projected CRS: SVY21
sg_sf <- st_read(dsn = "data/sg", layer="CostalOutline")
Reading layer `CostalOutline' from data source
`C:\yiling-yu\IS415_Blog\_posts\2021-09-25-take-home-exercise-2\data\sg'
using driver `ESRI Shapefile'
Simple feature collection with 60 features and 4 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 2663.926 ymin: 16357.98 xmax: 56047.79 ymax: 50244.03
Projected CRS: SVY21
bus_sf <- st_read(dsn = "data/BusStopLocation", layer="BusStop")
Reading layer `BusStop' from data source
`C:\yiling-yu\IS415_Blog\_posts\2021-09-25-take-home-exercise-2\data\BusStopLocation'
using driver `ESRI Shapefile'
Simple feature collection with 5156 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 4427.938 ymin: 26482.1 xmax: 48282.5 ymax: 52983.82
Projected CRS: SVY21
listings21 <- read_csv("data/Airbnb_listings/29062021.csv")
listings19 <- read_csv("data/Airbnb_listings/30062019.csv")
hotels <- read_csv("data/OneMap_Data/hotels.csv")
tourism <- read_csv("data/OneMap_Data/tourism.csv")
hawker_sf <- st_read("data/hawker_centres/hawker-centres-geojson.geojson") %>%
st_transform(crs = 3414)
Reading layer `hawker-centres-geojson' from data source
`C:\yiling-yu\IS415_Blog\_posts\2021-09-25-take-home-exercise-2\data\hawker_centres\hawker-centres-geojson.geojson'
using driver `GeoJSON'
Simple feature collection with 125 features and 2 fields
Geometry type: POINT
Dimension: XYZ
Bounding box: xmin: 103.6974 ymin: 1.272716 xmax: 103.9882 ymax: 1.449217
z_range: zmin: 0 zmax: 0
Geodetic CRS: WGS 84
listings21_sf <- st_as_sf(listings21,
coords = c("longitude", "latitude"),
crs=4326) %>%
st_transform(crs = 3414)
listings19_sf <- st_as_sf(listings19,
coords = c("longitude", "latitude"),
crs=4326) %>%
st_transform(crs = 3414)
hotels_sf <- st_as_sf(hotels,
coords = c("Lng", "Lat"),
crs=4326) %>%
st_transform(crs = 3414)
tourism_sf <- st_as_sf(tourism,
coords = c("Lng", "Lat"),
crs=4326) %>%
st_transform(crs = 3414)
MRT_sf <- st_set_crs(MRT_sf, 3414)
sg_sf <- st_set_crs(sg_sf, 3414)
bus_sf <- st_set_crs(bus_sf, 3414)
tmap_mode("view")
tmap_options(check.and.fix = TRUE)
tm_shape(sg_sf) +
tm_polygons() +
tm_shape(listings19_sf) +
tm_dots(alpha=0.4,
col="blue",
size=0.05) +
tm_shape(listings21_sf) +
tm_dots(alpha=0.4,
col="red",
size=0.05)